package com.ttianjun.spring.controller;

import com.ttianjun.spring.model.ClassInfo;
import com.ttianjun.spring.service.ClassInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by djei on 2015-04-22.
 */
@Controller
public class HelloWorldController {
    @Autowired
    private ClassInfoService classInfoService;

    @RequestMapping("/")
    public String hello(@RequestParam(value="name", required=false, defaultValue="World") String name, Model model) {
        List<ClassInfo> list = classInfoService.getClassInfoByStudentcount(7);
        model.addAttribute("list", list);
        return "index";
    }
}
